<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="UTF-8">
    <title>教师评教管理系统</title>
    <link rel="stylesheet" href="./layui/css/layui.css">
    <link rel="stylesheet" href="./css/treemenu.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header  "  style="background-color: #35414F">
        <ul class="layui-nav " >
            <li class="layui-nav-item" style="font-size:30px;position: absolute;letter-spacing: 10px;color:lightgray">教师评教管理系统</li>
        </ul>
        <!--     头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item" id="userInfo" style="right: 80px;color: lightgray"></li>
            <li class="layui-nav-item" style="top: 18px;right:20px;top: 0px;position: absolute"><button class="layui-btn  " id="exitUser">注销</button></li>
        </ul>
    </div>

    <!--   <div class="layui-side layui-bg-black">
           <div class="layui-side-scroll">
               &lt;!&ndash;     左侧导航区域（可配合layui已有的垂直导航） &ndash;&gt;
               <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                   <li class="layui-nav-item layui-nav-itemed">
                       <a class="paper" href="javascript:;" ><span>用户管理</span></a>
                       <dl class="layui-nav-child">
                           <dd><a href="userlist.html"  target="content"><span>查看用户</span></a></dd>
                           <dd><a href="${ctx}/addUser" target="content"><span>添加用户</span></a></dd>
                       </dl>
                   </li>

                   <li class="layui-nav-item layui-nav-itemed">
                       <a class="sale" href="javascript:;">角色管理</a>
                       <dl class="layui-nav-child">
                           <dd><a href="${ctx}/getAllPlayers" target="content">查看角色</a></dd>
                           <dd><a href="${ctx}/addPlayer" target="content">添加角色</a></dd>
                       </dl>
                   </li>

                   <li class="layui-nav-item layui-nav-itemed">
                       <a class="input" href="javascript:;">功能管理</a>
                       <dl class="layui-nav-child">
                           <dd><a href="${ctx}/getAllVotes" target="content">查看功能</a></dd>
                           <dd><a href="${ctx}/addPlayer" target="content">添加角色</a></dd>
                       </dl>
                   </li>


                   <li class="layui-nav-item layui-nav-itemed">
                       <a class="input" href="javascript:;">评教管理</a>
                       <dl class="layui-nav-child">
                           <dd><a href="evaluate.html" target="content">学生评教</a></dd>
                           <dd><a href="${ctx}/getAllMatches" target="content">老师评教</a></dd>
                           <dd><a href="${ctx}/getAllMatches" target="content">院系评教</a></dd>
                           <dd><a href="${ctx}/getAllMatches" target="content">教研室评教</a></dd>
                       </dl>
                   </li>


               </ul>
           </div>
       </div>-->
    <div class="layui-side " style="height: 100%;background-color: #35414F">
        <div class="layui-side-scroll " >
            <div id="sidemenubar" lay-filter="test"></div>
        </div>
    </div>



    <div class="layui-body" >
        <div class="content" style="height: 100%">
            <iframe   src="content.html" name="content" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe>
        </div>
    </div>

    <div class="layui-footer" style="background-color: #ffffff">
        ©在线教师评教系统
    </div>
</div>
<script src="./layui/layui.all.js"></script>
<script>
    //JavaScript代码区域
    layui.use('element', function(){
        var element = layui.element,
            $ = layui.jquery;



        $.ajax({
            url:"/evaluation/user/getUserInfo",
            type:"get",
            data:{},
            dataType:"json",
            success:function(data){
                var username = data.data.username;
                var userNo = data.data.userNo;
                $("#userInfo").text(username + "    " + userNo);

            },
            error:function(xmlHttpRequest,textStatus,errorThrown){
                alert("用户已过期，请重新登录");
                // alert(textStatus+"出错！"+errorThrown);
            }
        });


        $("#exitUser").click(function(){
            $.ajax({
                url:"/evaluation/user/exitUser",
                type:"get",
                data:{},
                dataType:"json",
                success:function(data){
                    window.location.href ="login.html";
                },
                error:function(xmlHttpRequest,textStatus,errorThrown){
                    alert(textStatus+"出错！"+errorThrown);
                }
            });
        });


        //添加选中颜色显示

        $("body").on("mouseover", ".layui-tree a", function() {

            if(!$(this).siblings('ul').length) {

                $(".layui-tree a").removeClass('active');

                $(this).find('cite').parent().addClass('active');

            }

        });


        $.ajax({
            url:"/evaluation/tree/getTree",
            type:"get",
            data:{},
            dataType:"json",
            success:function(data){
                layui.tree({
                    elem: '#sidemenubar' //传入元素选择器
                    ,skin: 'sidebar'  //自定义tree样式的类名
                    ,nodes: [data.data]
                    ,target:'content'
                    ,click: function(node,item){
                        //node即为当前点击的节点数据,item就是被点击的a标签对象了
                        //导航按钮选中当前
                        $('#sidemenubar a').removeClass('active');
                        $(item).addClass('active');
                        $(item).siblings('.layui-tree-spread').cliuser/listck();
                    }
                });
                // alert(data.data.actionName);
            },
            error:function(xmlHttpRequest,textStatus,errorThrown){
                alert(textStatus+"出错！"+errorThrown);
            }
        });








    });
</script>


</body>
</html>